package hc.bre.runner

@groovy.transform.CompileStatic
class ScriptBlockRunner extends RuleRunnerSupportEx{
	String scriptBlock;
	String instruction;
	public Object run(Object namedArgsMap) {
		Binding binding = new Binding(namedArgsMap as Map)

		def shell = new GroovyShell(binding, configuration(ruledir));

		if(!instruction) instruction ="result=with(${classShortName()}.rule)";

		shell.evaluate(scriptBlock +"\n"+ instruction)

		return binding.variables
	}
}
